package com.leoman.banner.dao;

import com.leoman.address.entity.Address;
import com.leoman.banner.entity.Banner;
import com.leoman.common.dao.IBaseJpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Administrator on 2016/6/12.
 */
public interface BannerDao extends IBaseJpaRepository<Banner> {

    @Query("select a from Banner a where a.position = ?1 and a.workId = ?2")
    public List<Banner> findByTypeAndWorkId(Integer type, Long workId);

    @Query("select a from Banner a where a.position = ?1 and a.categoryId = ?2")
    public List<Banner> findByTypeAndCategoryId(Integer type, Long categoryId);

    @Query("select a from Banner a where a.position = ?1 and a.categoryId = ?2 and a.workId = ?3")
    public List<Banner> findMusicAndGame(Integer type, Long categoryId, Long workId);
}
